﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SugarWebApi
{

	public abstract class SugarWebCommand
	{

		#region Constructors

		public SugarWebCommand(
			SugarWebConext context,
			SugarWebProcessor processor,
			SugarWebParameters parameters)
		{
			this._processor = processor;
			this._parameters = parameters;
		}

		#endregion

		#region Fields

		private readonly SugarWebConext _context;
		private readonly SugarWebParameters _parameters;
		private readonly SugarWebProcessor _processor;
		
		#endregion

		#region Properties

		public SugarWebConext Conext
		{
			get { return _context; }
		}

		public SugarWebParameters Parameters
		{
			get { return _parameters; }
		}

		public SugarWebProcessor Processor
		{
			get { return _processor; }
		}

		#endregion

		#region Methods

		public SugarWebResult Execute()
		{
			return this.Processor.Process(this);
		}

		#endregion
	}
}
